package com.ytjj.qmyx.admin.service.impl;

import com.github.pagehelper.PageHelper;
import com.ytjj.common.api.CommonPage;
import com.ytjj.common.exception.ApiException;
import com.ytjj.qmyx.admin.dao.HotProductRecommendDao;
import com.ytjj.qmyx.admin.model.request.HotProductRecommendRequest;
import com.ytjj.qmyx.admin.model.response.HotProductRecommendResponse;
import com.ytjj.qmyx.admin.service.HotProductRecommendService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 *
 * 
 * @Version: 1.0
 */
@Service
public class HotProductRecommendServiceImpl implements HotProductRecommendService {

    @Resource
    private HotProductRecommendDao hotProductRecommendDao;

    @Override
    public CommonPage<HotProductRecommendResponse> selectList(HotProductRecommendRequest hotProductRecommendRequest) {
        PageHelper.startPage(hotProductRecommendRequest.getPageNum(), hotProductRecommendRequest.getPageSize());
        return CommonPage.restPage(hotProductRecommendDao.selectList(hotProductRecommendRequest));
    }

    @Override
    public Integer insertHotProductRecommend(Integer productId, Integer hotProductId, Integer sort) {
        return hotProductRecommendDao.insertHotProductRecommend(productId, hotProductId, sort);
    }

    @Override
    public Integer updateSort(Integer recommendId, Integer sort) {
        return hotProductRecommendDao.updateSort(recommendId, sort);
    }

    @Override
    public Integer removeData(Integer recommendId) {
        return hotProductRecommendDao.removeData(recommendId);
    }
}
